<template>
  <div class="notice_add">
    <el-page-header @back="goBack" content="发布通知">
    </el-page-header>

    <el-card style="width: 50%;height:50%;margin-left: 25%;margin-top: 10%">
      <h1 style="color: #55a1ff">通知内容</h1>
     <el-input v-model="form.noticeContent" type="textarea" style="height: 100px" placeholder="请在此处输入通知内容......"></el-input>
      <el-button type="primary" @click="publish()">发布</el-button>
    </el-card>
  </div>
</template>

<script>
import router from "@/router";
import {addNotice} from "@/api/admin_api";

export default {
  name: "notice_add",
  inject:['reload'],
  data() {
    return{
      form:{noticeContent:''}
    }
  },

  methods:{
    publish(){
      addNotice(this.form).then((res)=>{
        this.$message({
          message: '发布成功！',
          type: 'success'
        });
        this.reload()
      })
    },
    goBack(){
      //返回上一页面
      // history.back();
      this.$router.push("/admin");
    }

  },
}
</script>

<style scoped>

</style>